## problem 4

# Method: P(X>20) = 1 - P(X<=20), so find P(X<=20) first using R's built in integral function
#
integrand <- function(x) { ifelse(x>10,(10 / (x^2)),0) }
1 - integrate(integrand,lower=0,upper=20, subdivisions=10000)$value
# Answer: 0.5

# E(X), does it really exist??
ex <- function(x) { x*ifelse(x>10,(10 / (x^2)),0) }
integrate(ex,lower=0,upper=Inf)

# Maximum subdivisions reached.... looks like the integral does not converge.

